package com.guoxin.factory.simplefactory.pizzastore.order;

import com.guoxin.factory.TypeUtils;
import com.guoxin.factory.simplefactory.pizzastore.pizza.Pizza;

/**
 * 
 * @author Administrator
 *
 */
public class OrderPizzaUseSimpleFactory {

	public OrderPizzaUseSimpleFactory(SimpleFactory factory) {
		setFactory(factory);
	}

	private void setFactory(SimpleFactory factory) {
		Pizza pizza;
		do {
			String type = TypeUtils.getType();
			pizza = factory.createPizza(type);
			if(pizza!=null){
				pizza.show();
			}else{
				System.out.println("订购失败~~~");
				break;
			}
		} while (true);
	}

}
